


putexcel set "Results\tab_B3\table_5_eq", replace

putexcel B1 = "N (1,000s)"
putexcel B2 = "1980"
putexcel C2 = "2018"

putexcel D1 = "Sorting"
putexcel D2 = "1980"
putexcel E2 = "2018"
putexcel F2 = "Change"

putexcel G1 = "Gini, data"
putexcel G2 = "1980"
putexcel H2 = "2018"

putexcel I1 = "Gini (i)"
putexcel I2 = "2018"

putexcel J1 = "D Gini (i)/D Gini, data"




*Types by gender

putexcel A4 = "Types by gender"

clear
use "Results\tab_B3\Scenario_2\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B4 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C4 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D4 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E4 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F4 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_2\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G4 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H4 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I4 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J4 = temp5

*Types by cohort

putexcel A5 = "Types by cohort"

clear
use "Results\tab_B3\Scenario_3\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B5 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C5 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D5 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E5 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F5 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_3\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G5 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H5 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I5 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J5 = temp5

*Sub-field level

putexcel A6 = "Sub-field level"

clear
use "Results\tab_B3\Scenario_4\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B6 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C6 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D6 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E6 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F6 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_4\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G6 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H6 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I6 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J6 = temp5

*Three ambition types

putexcel A7 = "Three ambition types"

clear
use "Results\tab_B3\Scenario_5\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+female_1_marr+female_2_marr+female_3_marr+male_1_sing+male_2_sing+male_3_sing+female_1_sing+female_2_sing+female_3_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B7 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C7 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D7 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E7 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F7 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_5\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G7 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H7 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I7 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J7 = temp5

*Five ambition types

putexcel A8 = "Five ambition types"

clear
use "Results\tab_B3\Scenario_6\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+male_5_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+female_5_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+male_5_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing+female_5_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B8 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C8 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)+s_5_5*(0*male_5+(1-0)*female_5)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D8 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E8 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F8 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_6\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G8 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H8 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I8 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J8 = temp5


*Only g

putexcel A10 = "Only g"

clear
use "Results\tab_B3\Scenario_7\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B10 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C10 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D10 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E10 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F10 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_7\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G10 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H10 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I10 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J10 = temp5

*Only w0

putexcel A11 = "Only w0"

clear
use "Results\tab_B3\Scenario_8\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B11 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C11 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D11 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E11 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F11 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_8\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G11 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H11 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I11 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J11 = temp5




*Only male w0 and g

putexcel A12 = "Only male w0 and g"

clear
use "Results\tab_B3\Scenario_9\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B12 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C12 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D12 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E12 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F12 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_9\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G12 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H12 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I12 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J12 = temp5



*w0_inflex

putexcel A14 = "w0 and inflexibility"

clear
use "Results\tab_B3\Scenario_10\Sorting\results_ambition.dta"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B14 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C14 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D14 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E14 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F14 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_10\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G14 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H14 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I14 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J14 = temp5

*Majors split by uni

putexcel A15 = "Majors split by uni"

clear
use "Results\tab_B3\Scenario_11\Sorting\results_ambition.dta"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B15 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C15 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D15 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E15 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F15 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_11\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G15 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H15 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I15 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J15 = temp5




